3.18 \(\int \frac{d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx\)

Optimal. Leaf size=136 \[ -\frac{\tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right ) (d+f-2 h)}{2 \sqrt{3}}+\frac{\tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right ) (d+f-2 h)}{2 \sqrt{3}}-\frac{1}{4} (d-f) \log \left (x^2-x+1\right )+\frac{1}{4} (d-f) \log \left (x^2+x+1\right )+\frac{(2 e-g) \tan ^{-1}\left (\frac{2 x^2+1}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{1}{4} g \log \left (x^4+x^2+1\right )+h x \]

[Out]

h*x - ((d + f - 2*h)*ArcTan[(1 - 2*x)/Sqrt[3]])/(2*Sqrt[3]) + ((d + f - 2*h)*ArcTan[(1 + 2*x)/Sqrt[3]])/(2*Sqr
t[3]) + ((2*e - g)*ArcTan[(1 + 2*x^2)/Sqrt[3]])/(2*Sqrt[3]) - ((d - f)*Log[1 - x + x^2])/4 + ((d - f)*Log[1 +
x + x^2])/4 + (g*Log[1 + x^2 + x^4])/4

________________________________________________________________________________________

Rubi [A]  time = 0.139987, antiderivative size = 136, normalized size of antiderivative = 1., number of steps used = 17, number of rules used = 8, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.258, Rules used = {1673, 1676, 1169, 634, 618, 204, 628, 1247} \[ -\frac{\tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right ) (d+f-2 h)}{2 \sqrt{3}}+\frac{\tan ^{-1}\left (\frac{2 x+1}{\sqrt{3}}\right ) (d+f-2 h)}{2 \sqrt{3}}-\frac{1}{4} (d-f) \log \left (x^2-x+1\right )+\frac{1}{4} (d-f) \log \left (x^2+x+1\right )+\frac{(2 e-g) \tan ^{-1}\left (\frac{2 x^2+1}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{1}{4} g \log \left (x^4+x^2+1\right )+h x \]

Antiderivative was successfully verified.

[In]

Int[(d + e*x + f*x^2 + g*x^3 + h*x^4)/(1 + x^2 + x^4),x]

[Out]

h*x - ((d + f - 2*h)*ArcTan[(1 - 2*x)/Sqrt[3]])/(2*Sqrt[3]) + ((d + f - 2*h)*ArcTan[(1 + 2*x)/Sqrt[3]])/(2*Sqr
t[3]) + ((2*e - g)*ArcTan[(1 + 2*x^2)/Sqrt[3]])/(2*Sqrt[3]) - ((d - f)*Log[1 - x + x^2])/4 + ((d - f)*Log[1 +
x + x^2])/4 + (g*Log[1 + x^2 + x^4])/4

Rule 1673

Int[(Pq_)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_), x_Symbol] :> Module[{q = Expon[Pq, x], k}, Int[Sum[Coeff[
Pq, x, 2*k]*x^(2*k), {k, 0, q/2}]*(a + b*x^2 + c*x^4)^p, x] + Int[x*Sum[Coeff[Pq, x, 2*k + 1]*x^(2*k), {k, 0,
(q - 1)/2}]*(a + b*x^2 + c*x^4)^p, x]] /; FreeQ[{a, b, c, p}, x] && PolyQ[Pq, x] &&  !PolyQ[Pq, x^2]

Rule 1676

Int[(Pq_)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> Int[ExpandIntegrand[Pq/(a + b*x^2 + c*x^4), x], x
] /; FreeQ[{a, b, c}, x] && PolyQ[Pq, x^2] && Expon[Pq, x^2] > 1

Rule 1169

Int[((d_) + (e_.)*(x_)^2)/((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4), x_Symbol] :> With[{q = Rt[a/c, 2]}, With[{r =
Rt[2*q - b/c, 2]}, Dist[1/(2*c*q*r), Int[(d*r - (d - e*q)*x)/(q - r*x + x^2), x], x] + Dist[1/(2*c*q*r), Int[(
d*r + (d - e*q)*x)/(q + r*x + x^2), x], x]]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2
- b*d*e + a*e^2, 0] && NegQ[b^2 - 4*a*c]

Rule 634

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 1247

Int[(x_)*((d_) + (e_.)*(x_)^2)^(q_.)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_.), x_Symbol] :> Dist[1/2, Subst[
Int[(d + e*x)^q*(a + b*x + c*x^2)^p, x], x, x^2], x] /; FreeQ[{a, b, c, d, e, p, q}, x]

Rubi steps

\begin{align*} \int \frac{d+e x+f x^2+g x^3+h x^4}{1+x^2+x^4} \, dx &=\int \frac{x \left (e+g x^2\right )}{1+x^2+x^4} \, dx+\int \frac{d+f x^2+h x^4}{1+x^2+x^4} \, dx\\ &=\frac{1}{2} \operatorname{Subst}\left (\int \frac{e+g x}{1+x+x^2} \, dx,x,x^2\right )+\int \left (h+\frac{d-h+(f-h) x^2}{1+x^2+x^4}\right ) \, dx\\ &=h x+\frac{1}{4} (2 e-g) \operatorname{Subst}\left (\int \frac{1}{1+x+x^2} \, dx,x,x^2\right )+\frac{1}{4} g \operatorname{Subst}\left (\int \frac{1+2 x}{1+x+x^2} \, dx,x,x^2\right )+\int \frac{d-h+(f-h) x^2}{1+x^2+x^4} \, dx\\ &=h x+\frac{1}{4} g \log \left (1+x^2+x^4\right )+\frac{1}{2} \int \frac{d-h-(d-f) x}{1-x+x^2} \, dx+\frac{1}{2} \int \frac{d-h+(d-f) x}{1+x+x^2} \, dx+\frac{1}{2} (-2 e+g) \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,1+2 x^2\right )\\ &=h x+\frac{(2 e-g) \tan ^{-1}\left (\frac{1+2 x^2}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{1}{4} g \log \left (1+x^2+x^4\right )+\frac{1}{4} (d-f) \int \frac{1+2 x}{1+x+x^2} \, dx+\frac{1}{4} (-d+f) \int \frac{-1+2 x}{1-x+x^2} \, dx+\frac{1}{4} (d+f-2 h) \int \frac{1}{1-x+x^2} \, dx+\frac{1}{4} (d+f-2 h) \int \frac{1}{1+x+x^2} \, dx\\ &=h x+\frac{(2 e-g) \tan ^{-1}\left (\frac{1+2 x^2}{\sqrt{3}}\right )}{2 \sqrt{3}}-\frac{1}{4} (d-f) \log \left (1-x+x^2\right )+\frac{1}{4} (d-f) \log \left (1+x+x^2\right )+\frac{1}{4} g \log \left (1+x^2+x^4\right )+\frac{1}{2} (-d-f+2 h) \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,-1+2 x\right )+\frac{1}{2} (-d-f+2 h) \operatorname{Subst}\left (\int \frac{1}{-3-x^2} \, dx,x,1+2 x\right )\\ &=h x-\frac{(d+f-2 h) \tan ^{-1}\left (\frac{1-2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(d+f-2 h) \tan ^{-1}\left (\frac{1+2 x}{\sqrt{3}}\right )}{2 \sqrt{3}}+\frac{(2 e-g) \tan ^{-1}\left (\frac{1+2 x^2}{\sqrt{3}}\right )}{2 \sqrt{3}}-\frac{1}{4} (d-f) \log \left (1-x+x^2\right )+\frac{1}{4} (d-f) \log \left (1+x+x^2\right )+\frac{1}{4} g \log \left (1+x^2+x^4\right )\\ \end{align*}

Mathematica [C]  time = 0.601022, size = 165, normalized size = 1.21 \[ \frac{1}{24} \left (4 \tan ^{-1}\left (\frac{1}{2} \left (\sqrt{3}-i\right ) x\right ) \left (\left (\sqrt{3}+3 i\right ) d+\left (\sqrt{3}-3 i\right ) f-2 \sqrt{3} h\right )+4 \tan ^{-1}\left (\frac{1}{2} \left (\sqrt{3}+i\right ) x\right ) \left (\left (\sqrt{3}-3 i\right ) d+\left (\sqrt{3}+3 i\right ) f-2 \sqrt{3} h\right )-8 \sqrt{3} e \tan ^{-1}\left (\frac{\sqrt{3}}{2 x^2+1}\right )+6 g \log \left (x^4+x^2+1\right )+4 \sqrt{3} g \tan ^{-1}\left (\frac{\sqrt{3}}{2 x^2+1}\right )+24 h x\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(d + e*x + f*x^2 + g*x^3 + h*x^4)/(1 + x^2 + x^4),x]

[Out]

(24*h*x + 4*((3*I + Sqrt[3])*d + (-3*I + Sqrt[3])*f - 2*Sqrt[3]*h)*ArcTan[((-I + Sqrt[3])*x)/2] + 4*((-3*I + S
qrt[3])*d + (3*I + Sqrt[3])*f - 2*Sqrt[3]*h)*ArcTan[((I + Sqrt[3])*x)/2] - 8*Sqrt[3]*e*ArcTan[Sqrt[3]/(1 + 2*x
^2)] + 4*Sqrt[3]*g*ArcTan[Sqrt[3]/(1 + 2*x^2)] + 6*g*Log[1 + x^2 + x^4])/24

________________________________________________________________________________________

Maple [B]  time = 0.004, size = 241, normalized size = 1.8 \begin{align*} hx+{\frac{d\ln \left ({x}^{2}+x+1 \right ) }{4}}-{\frac{\ln \left ({x}^{2}+x+1 \right ) f}{4}}+{\frac{\ln \left ({x}^{2}+x+1 \right ) g}{4}}+{\frac{d\sqrt{3}}{6}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }-{\frac{\sqrt{3}e}{3}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}f}{6}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}g}{6}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }-{\frac{\sqrt{3}h}{3}\arctan \left ({\frac{ \left ( 1+2\,x \right ) \sqrt{3}}{3}} \right ) }+{\frac{\ln \left ({x}^{2}-x+1 \right ) f}{4}}-{\frac{d\ln \left ({x}^{2}-x+1 \right ) }{4}}+{\frac{\ln \left ({x}^{2}-x+1 \right ) g}{4}}+{\frac{d\sqrt{3}}{6}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}e}{3}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }+{\frac{\sqrt{3}f}{6}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }-{\frac{\sqrt{3}g}{6}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) }-{\frac{\sqrt{3}h}{3}\arctan \left ({\frac{ \left ( 2\,x-1 \right ) \sqrt{3}}{3}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((h*x^4+g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x)

[Out]

h*x+1/4*d*ln(x^2+x+1)-1/4*ln(x^2+x+1)*f+1/4*ln(x^2+x+1)*g+1/6*d*arctan(1/3*(1+2*x)*3^(1/2))*3^(1/2)-1/3*3^(1/2
)*arctan(1/3*(1+2*x)*3^(1/2))*e+1/6*3^(1/2)*arctan(1/3*(1+2*x)*3^(1/2))*f+1/6*3^(1/2)*arctan(1/3*(1+2*x)*3^(1/
2))*g-1/3*3^(1/2)*arctan(1/3*(1+2*x)*3^(1/2))*h+1/4*ln(x^2-x+1)*f-1/4*d*ln(x^2-x+1)+1/4*ln(x^2-x+1)*g+1/6*3^(1
/2)*arctan(1/3*(2*x-1)*3^(1/2))*d+1/3*3^(1/2)*arctan(1/3*(2*x-1)*3^(1/2))*e+1/6*3^(1/2)*arctan(1/3*(2*x-1)*3^(
1/2))*f-1/6*3^(1/2)*arctan(1/3*(2*x-1)*3^(1/2))*g-1/3*3^(1/2)*arctan(1/3*(2*x-1)*3^(1/2))*h

________________________________________________________________________________________

Maxima [A]  time = 1.48999, size = 124, normalized size = 0.91 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (d - 2 \, e + f + g - 2 \, h\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (d + 2 \, e + f - g - 2 \, h\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + h x + \frac{1}{4} \,{\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x^4+g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="maxima")

[Out]

1/6*sqrt(3)*(d - 2*e + f + g - 2*h)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sqrt(3)*(d + 2*e + f - g - 2*h)*arctan
(1/3*sqrt(3)*(2*x - 1)) + h*x + 1/4*(d - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)

________________________________________________________________________________________

Fricas [A]  time = 11.1041, size = 285, normalized size = 2.1 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (d - 2 \, e + f + g - 2 \, h\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (d + 2 \, e + f - g - 2 \, h\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + h x + \frac{1}{4} \,{\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x^4+g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="fricas")

[Out]

1/6*sqrt(3)*(d - 2*e + f + g - 2*h)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sqrt(3)*(d + 2*e + f - g - 2*h)*arctan
(1/3*sqrt(3)*(2*x - 1)) + h*x + 1/4*(d - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x**4+g*x**3+f*x**2+e*x+d)/(x**4+x**2+1),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [A]  time = 1.10218, size = 127, normalized size = 0.93 \begin{align*} \frac{1}{6} \, \sqrt{3}{\left (d + f + g - 2 \, h - 2 \, e\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x + 1\right )}\right ) + \frac{1}{6} \, \sqrt{3}{\left (d + f - g - 2 \, h + 2 \, e\right )} \arctan \left (\frac{1}{3} \, \sqrt{3}{\left (2 \, x - 1\right )}\right ) + h x + \frac{1}{4} \,{\left (d - f + g\right )} \log \left (x^{2} + x + 1\right ) - \frac{1}{4} \,{\left (d - f - g\right )} \log \left (x^{2} - x + 1\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((h*x^4+g*x^3+f*x^2+e*x+d)/(x^4+x^2+1),x, algorithm="giac")

[Out]

1/6*sqrt(3)*(d + f + g - 2*h - 2*e)*arctan(1/3*sqrt(3)*(2*x + 1)) + 1/6*sqrt(3)*(d + f - g - 2*h + 2*e)*arctan
(1/3*sqrt(3)*(2*x - 1)) + h*x + 1/4*(d - f + g)*log(x^2 + x + 1) - 1/4*(d - f - g)*log(x^2 - x + 1)